/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmconsprof.java
 *
 * Created on 18/02/2011, 11:37:33 PM
 */
package interfaz1;

import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frmconsprof extends javax.swing.JFrame {

    /** Creates new form Frmconsprof */
    public Frmconsprof() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblconsprof = new javax.swing.JLabel();
        lblcedconsprof = new javax.swing.JLabel();
        lblnomconsprof = new javax.swing.JLabel();
        lblapconsprof = new javax.swing.JLabel();
        lbltitconsprof = new javax.swing.JLabel();
        txtcedconsprof = new javax.swing.JTextField();
        txtnomconsprof = new javax.swing.JTextField();
        txtapconsprof = new javax.swing.JTextField();
        txttitconsprof = new javax.swing.JTextField();
        btnbuscarconsprof = new javax.swing.JButton();
        btncancconsprof = new javax.swing.JButton();
        btnsalirconsprof = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Profesor");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblconsprof.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        lblconsprof.setText("Consultar Profesor");
        getContentPane().add(lblconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 20, 150, 20));

        lblcedconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedconsprof.setText("Cedula:");
        getContentPane().add(lblcedconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 70, 60, 20));

        lblnomconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblnomconsprof.setText("Nombre:");
        getContentPane().add(lblnomconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, 50, 20));

        lblapconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblapconsprof.setText("Apellido:");
        getContentPane().add(lblapconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 150, 50, 20));

        lbltitconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lbltitconsprof.setText("Titulo Obtenido:");
        getContentPane().add(lbltitconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 190, 90, 20));

        txtcedconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtcedconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 130, -1));

        txtnomconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtnomconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 110, 130, -1));

        txtapconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtapconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 150, 130, -1));

        txttitconsprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txttitconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 190, 130, -1));

        btnbuscarconsprof.setText("Buscar");
        btnbuscarconsprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnbuscarconsprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnbuscarconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 70, -1, -1));

        btncancconsprof.setText("Cancelar");
        btncancconsprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancconsprofActionPerformed(evt);
            }
        });
        getContentPane().add(btncancconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 250, -1, -1));

        btnsalirconsprof.setText("Salir");
        btnsalirconsprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirconsprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirconsprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 250, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirconsprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirconsprofActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btnsalirconsprofActionPerformed

    private void btncancconsprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancconsprofActionPerformed
        // TODO add your handling code here:
        txtapconsprof.setText("");
        txtcedconsprof.setText("");
        txtnomconsprof.setText("");
        txttitconsprof.setText("");

    }//GEN-LAST:event_btncancconsprofActionPerformed

    private void btnbuscarconsprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnbuscarconsprofActionPerformed
        // TODO add your handling code here:
        Profesor miprofesor = FrmOperacionesseccion.getMiseccion().BuscarProfesor(txtcedconsprof.getText());
        if (miprofesor != null) {
            txtnomconsprof.setText(miprofesor.getNombre());
            txtapconsprof.setText(miprofesor.getApellido());
            txtcedconsprof.setText(miprofesor.getCedula());
            txttitconsprof.setText(miprofesor.getTituloA());
        } else {
            JOptionPane.showMessageDialog(new Frame(), "El profesor no existe", "Aviso", JOptionPane.PLAIN_MESSAGE);
        }
    }//GEN-LAST:event_btnbuscarconsprofActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frmconsprof().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnbuscarconsprof;
    private javax.swing.JButton btncancconsprof;
    private javax.swing.JButton btnsalirconsprof;
    private javax.swing.JLabel lblapconsprof;
    private javax.swing.JLabel lblcedconsprof;
    private javax.swing.JLabel lblconsprof;
    private javax.swing.JLabel lblnomconsprof;
    private javax.swing.JLabel lbltitconsprof;
    private javax.swing.JTextField txtapconsprof;
    private javax.swing.JTextField txtcedconsprof;
    private javax.swing.JTextField txtnomconsprof;
    private javax.swing.JTextField txttitconsprof;
    // End of variables declaration//GEN-END:variables
}
